<?php
//
// +------------------------------------------------------------------------+
// | PHP Version 5.4                                                        |
// +------------------------------------------------------------------------+
// | Copyright (c) All rights reserved.                                     |
// +------------------------------------------------------------------------+
// | 世纪车来车往(北京）网络科技有限公司 版权所有！                                 |
// | TEL:010-63732365  HOTLINE:400-6688-365  EMAIL:clcw@clcw.com.cn         |
// | $Revision: 1.0 $                                                       |
// +------------------------------------------------------------------------+
// | Author: xiangminghu@clcw.com.cn                                        |
// +------------------------------------------------------------------------+
//
namespace AuctionBack\Controller;

use AuctionCore\Common\AjaxPage;

class ReportQuestionController extends BaseController
{
    private $questionLogic;

    public function __construct()
    {
        parent::__construct();
        $this->questionLogic = D('Question', 'Logic');
    }

    public function index()
    {
        $this->display();
    }

    /**
     *　举报提问管理列表
     */
    public function reportQuestionList()
    {
        $page = I("get.p", 1);
        $size = 10;
        $params = [];
        $params['q_id'] = I('get.q_id/d', 0);
        $params['q_brand'] = I('get.q_brand', '', 'trim');
        $params['q_keywords'] = I('get.q_keywords', '');
        $params['q_uid'] = I('get.q_uid/d', 0);
        $params['q_status'] = I('get.q_status/d', 0);
        $params['start_time'] = I('get.start_time', '');
        $params['end_time'] = I('get.end_time', '');
        $result = $this->questionLogic->getReportQuestionList($page, $size, $params);
        $list = !empty($result['list']) ? $result['list'] : [];
        $Page = new AjaxPage($result['total'], $size, "get_page");
        $Page->setConfig('theme', " %totalRow% %header% %nowPage%/%totalPage% 页 %first% %upPage% %prePage% %linkPage% %nextPage% %downPage%  %end% %jumpform%");
        $show = $Page->show();          // 分页显示输出
        $this->assign('page', $show);   // 赋值分页输出
        $this->assign('list', $list);
        $this->assign('p', $page);
        $this->assign('total', $result['total']);
        $this->assign('params', $params);
        $this->display();
    }


    /**
     * 提问举报管理详情
     */
    public function reportQuestionInfo()
    {
        $id = I('get.id/d', 0);
        if ($id < 1) {
            $this->redirect('CommonQuestion/index', '', 1, '请求出错了');
        }
        $question_info = $this->questionLogic->getReportQuestionInfo($id);
        $this->assign('question', $question_info);
        $this->display();
    }
}